package com.ougy.reshop.model;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

@Entity
public class Goods {
	private int id;

	private String goods_name;
	private Shop shop;
	private String seo_keywords;
	private String seo_description;
	private BigDecimal goods_price;
	private int goods_salenum;

	private String goods_details;
	private boolean shop_recommend;

	private int goods_collect;
	private int goods_views;

	private int goods_status;
	private Date goods_seller_time;
	private Date goods_end_time;
	private int goods_transfee;
	private int goods_auction;

	private Accessory goods_main_photo;
	private List<Accessory> goods_photos = new ArrayList<Accessory>();

	private Type type;
	private User user;

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne
	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getGoods_name() {
		return goods_name;
	}

	public void setGoods_name(String goods_name) {
		this.goods_name = goods_name;
	}

	public String getSeo_keywords() {
		return seo_keywords;
	}

	public void setSeo_keywords(String seo_keywords) {
		this.seo_keywords = seo_keywords;
	}

	@Lob
	@Column(columnDefinition = "LongText")
	public String getSeo_description() {
		return seo_description;
	}

	public void setSeo_description(String seo_description) {
		this.seo_description = seo_description;
	}

	@Column(precision = 12, scale = 2)
	public BigDecimal getGoods_price() {
		return goods_price;
	}

	public void setGoods_price(BigDecimal goods_price) {
		this.goods_price = goods_price;
	}

	public int getGoods_salenum() {
		return goods_salenum;
	}

	public void setGoods_salenum(int goods_salenum) {
		this.goods_salenum = goods_salenum;
	}

	@Lob
	@Column(columnDefinition = "LongText")
	public String getGoods_details() {
		return goods_details;
	}

	public void setGoods_details(String goods_details) {
		this.goods_details = goods_details;
	}

	public boolean isShop_recommend() {
		return shop_recommend;
	}

	public void setShop_recommend(boolean shop_recommend) {
		this.shop_recommend = shop_recommend;
	}

	public int getGoods_collect() {
		return goods_collect;
	}

	public void setGoods_collect(int goods_collect) {
		this.goods_collect = goods_collect;
	}

	public int getGoods_views() {
		return goods_views;
	}

	public void setGoods_views(int goods_views) {
		this.goods_views = goods_views;
	}

	public int getGoods_status() {
		return goods_status;
	}

	public void setGoods_status(int goods_status) {
		this.goods_status = goods_status;
	}

	public Date getGoods_seller_time() {
		return goods_seller_time;
	}

	public void setGoods_seller_time(Date goods_seller_time) {
		this.goods_seller_time = goods_seller_time;
	}

	public Date getGoods_end_time() {
		return goods_end_time;
	}

	public void setGoods_end_time(Date goods_end_time) {
		this.goods_end_time = goods_end_time;
	}

	public int getGoods_transfee() {
		return goods_transfee;
	}

	public void setGoods_transfee(int goods_transfee) {
		this.goods_transfee = goods_transfee;
	}

	public int getGoods_auction() {
		return goods_auction;
	}

	public void setGoods_auction(int goods_auction) {
		this.goods_auction = goods_auction;
	}

	@OneToOne
	public Accessory getGoods_main_photo() {
		return goods_main_photo;
	}

	public void setGoods_main_photo(Accessory goods_main_photo) {
		this.goods_main_photo = goods_main_photo;
	}

	@ManyToMany
	@JoinTable(name = "shop_goods_photo",
			joinColumns = {
				@javax.persistence.JoinColumn(name = "goods_id") 
			},
			inverseJoinColumns = { @javax.persistence.JoinColumn(name = "photo_id") })
	public List<Accessory> getGoods_photos() {
		return goods_photos;
	}

	public void setGoods_photos(List<Accessory> goods_photos) {
		this.goods_photos = goods_photos;
	}
	@ManyToOne
	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}
	@ManyToOne
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
